$(".address-bd .address-option .weui_switch1").click(function() {
    if ($(this).is(':checked')) {
        $(this).siblings(".ceng").hide();
		$(".elevator1").val("2");
		
    } else {
        $(this).siblings(".ceng").show();
		$(".elevator1").val("1");
    }

});

$(".address-bd .address-option .weui_switch2").click(function() {
    if ($(this).is(':checked')) {
        $(this).siblings(".ceng").hide();
		$(".elevator2").val("2");
    } else {
        $(this).siblings(".ceng").show();
		$(".elevator2").val("1");
    }

});


$("#select-cart").click(function () {
	$("#page-home").hide();
	$("#page-select-car").fadeIn();
});


function getDate(dates){
	"use strict";
	var dd = new Date();
    dd.setDate(dd.getDate()+dates);
    var y = dd.getFullYear();
    var m = dd.getMonth()+1;
    var d = dd.getDate();
    
	return y+"-"+m+"-"+d;
}

function getMyWeek3(){
	"use strict";
	var week;
	var myDate;
	
	myDate = new Date();
    myDate.setDate(myDate.getDate()+3);
	
	switch (myDate.getDay()){
		case 0:
			week="周日";
			break;
		case 1:
			week="周一";
			break;
		case 2:
			week="周二";
			break;
		case 3:
			week="周三";
			break;
		case 4:
			week="周四";
			break;
		case 5:
			week="周五";
			break;
		case 6:
			week="周六";
			break;
	}
	return week;
}

function getMyWeek4(){
	"use strict";
	var week;
	var myDate;
	
	myDate = new Date();
    myDate.setDate(myDate.getDate()+4);
	
	switch (myDate.getDay()){
		case 0:
			week="周日";
			break;
		case 1:
			week="周一";
			break;
		case 2:
			week="周二";
			break;
		case 3:
			week="周三";
			break;
		case 4:
			week="周四";
			break;
		case 5:
			week="周五";
			break;
		case 6:
			week="周六";
			break;
	}
	return week;
}

function getMyWeek5(){
	"use strict";
	var week;
	var myDate;
	
	myDate = new Date();
    myDate.setDate(myDate.getDate()+5);
	
	switch (myDate.getDay()){
		case 0:
			week="周日";
			break;
		case 1:
			week="周一";
			break;
		case 2:
			week="周二";
			break;
		case 3:
			week="周三";
			break;
		case 4:
			week="周四";
			break;
		case 5:
			week="周五";
			break;
		case 6:
			week="周六";
			break;
	}
	return week;
}

function getMyWeek6(){
	"use strict";
	var week;
	var myDate;
	
	myDate = new Date();
    myDate.setDate(myDate.getDate()+6);
	
	switch (myDate.getDay()){
		case 0:
			week="周日";
			break;
		case 1:
			week="周一";
			break;
		case 2:
			week="周二";
			break;
		case 3:
			week="周三";
			break;
		case 4:
			week="周四";
			break;
		case 5:
			week="周五";
			break;
		case 6:
			week="周六";
			break;
	}
	return week;
}

function getMyWeek7(){
	"use strict";
	var week;
	var myDate;
	
	myDate = new Date();
    myDate.setDate(myDate.getDate()+7);
	
	switch (myDate.getDay()){
		case 0:
			week="周日";
			break;
		case 1:
			week="周一";
			break;
		case 2:
			week="周二";
			break;
		case 3:
			week="周三";
			break;
		case 4:
			week="周四";
			break;
		case 5:
			week="周五";
			break;
		case 6:
			week="周六";
			break;
	}
	return week;
}


$("#select-time").picker({
    title: "预约时间",
    toolbarCloseText: "确认",
    cols: [{
        textAlign: 'center',
        values: ['今天（'+getDate(0)+'）','明天（'+getDate(1)+'）','后天（'+getDate(2)+'）',getMyWeek3()+'（'+getDate(3)+'）',getMyWeek4()+'（'+getDate(4)+'）',getMyWeek5()+'（'+getDate(5)+'）',getMyWeek6()+'（'+getDate(6)+'）',getMyWeek7()+'（'+getDate(7)+'）']
    }, {
        textAlign: 'center',
        values: ['早晨 07:00 - 09:00','上午 09:00 - 11:00', '中午 11:00 - 14:00', '下午 14:00 - 17:00', '傍晚 17:00 - 20:00']
    }],
    onClose: function() {
        $("#select-time").parent(".ban-item").addClass("on");
    }
});


$("#change_cart").click(function () {
	$("#page-home").hide();
	$("#page-select-car").fadeIn();
});

function back() {
	$("#page-select-car").hide();
	$("#page-home").fadeIn();
}
function jsbz() {
	$("#jsbz").removeClass('hide');
}
function close() {
	$("#jsbz").addClass('hide');
}

//改变车型,修改车费
$(".car1").click(function() {
	$("#car").val("面包车");
	chuanAjax();
	$("#page-select-car").hide();
	$("#page-home").fadeIn();
	
});

$(".car2").click(function() {
	$("#car").val("小型平板货车");
	chuanAjax();
	$("#page-select-car").hide();
	$("#page-home").fadeIn();
	
});

$(".car3").click(function() {
	$("#car").val("中型平板货车");
	chuanAjax();
	$("#page-select-car").hide();
	$("#page-home").fadeIn();
	
});

$(".car4").click(function() {
	$("#car").val("中型厢式货车");
	chuanAjax();
	$("#page-select-car").hide();
	$("#page-home").fadeIn();
	
});